home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS20.ADF / BobEd / drawbox.c < prev    next >
C/C++ Source or Header  |  1989-01-27  |  2KB  |  63 lines

  1. #include <bobed.h>
  2.  
  3. /*
  4.    drawbox.c
  5.    This function draws the edit and object boxes on the screen.
  6. */
  7.  
  8. extern struct RastPort *rp;
  9. SHORT  boxes [2][HBOBS*VBOBS];
  10. SHORT  colorbox [10];   /* array to hold the color selected box co-ords */
  11.  
  12. VOID drawboxes ()
  13. {
  14.    int   xx,yy;
  15.    int   xoffs,yoffs;
  16.    int   cboxw=(WIDE > 320 ? 2 : 1);
  17.  
  18.    SetAPen (rp,1);
  19.    for (yy=0;yy<VBOBS;yy++)
  20.    {
  21.       yoffs = TOFFSET+(BHIGH+1)*yy+(HIGH-TOFFSET-BOFFSET-BHIGH*VBOBS)/VBOBS*yy;
  22.       for (xx=0;xx<HBOBS;xx++)
  23.       {
  24.          xoffs = HWIDE+(BWIDE*16+1)*xx+(HWIDE-BWIDE*HBOBS*16)/HBOBS*xx;
  25.          boxes [0][yy*HBOBS+xx] = xoffs; /* x pt of view box */
  26.          boxes [1][yy*HBOBS+xx] = yoffs; /* y pt of view box */
  27.          Move (rp, xoffs-1,yoffs-1);
  28.          Draw (rp, xoffs+BWIDE*16,yoffs-1);
  29.          Draw (rp, xoffs+BWIDE*16,yoffs+BHIGH);
  30.          Draw (rp, xoffs-1,yoffs+BHIGH);
  31.          Draw (rp, xoffs-1,yoffs-1);
  32.       }
  33.    }
  34.  
  35. /* this draws the large edit box on the left of the screen */
  36.  
  37.    Move (rp, LOFFSET-1,TOFFSET-1);  /* draw big draw box */
  38.    Draw (rp, HWIDE-ROFFSET,TOFFSET-1);
  39.    Draw (rp, HWIDE-ROFFSET,HIGH-BOFFSET);
  40.    Draw (rp, LOFFSET-1,HIGH-BOFFSET);
  41.    Draw (rp, LOFFSET-1,TOFFSET-1);
  42.  
  43. /*
  44.    The colorbox is the small box to the left of the color select gadgets
  45.    that shows the currently selected color.
  46. */
  47.    colorbox [0]=WIDE-ROFFSET-30*cboxw; /* could have been initialized as */
  48.    colorbox [1]=HIGH-30;               /* a border  */
  49.    colorbox [2]=WIDE-ROFFSET;
  50.    colorbox [3]=HIGH-30;
  51.    colorbox [4]=WIDE-ROFFSET;
  52.    colorbox [5]=HIGH-13;
  53.    colorbox [6]=WIDE-ROFFSET-30*cboxw;
  54.    colorbox [7]=HIGH-13;
  55.    colorbox [8]=WIDE-ROFFSET-30*cboxw;
  56.    colorbox [9]=HIGH-30;
  57.  
  58.    Move (rp, colorbox [0],colorbox[1]);
  59.    for (xx=2;xx<10;xx+=2)
  60.       Draw (rp, colorbox [xx],colorbox[xx+1]);
  61. }
  62.  
  63.